solution   7784

« earlier    

Primer on Python Decorators – Real Python | https://realpython.com/
<code class="language-python">
def repeat(_func=None, *, num_times=2):
def decorator_repeat(func):
@functools.wraps(func)
def wrapper_repeat(*args, **kwargs):
for _ in range(num_times):
value = func(*args, **kwargs)
return value
return wrapper_repeat

if _func is None:
return decorator_repeat
else:
return decorator_repeat(_func)
</code>
python  newbie  language  idiom  decorators  solution 
2 days ago by kme
How to pass password to mysql command line - Unix & Linux Stack Exchange | https://unix.stackexchange.com/
It doesn't look like you can send a password to 'mysql' on stdin, even though that's where it seems to be expecting it from with the '-p' (no password) option.

So I ended up using the '--defaults-file' option.
mysql  cli  dba  commandline  pipes  subprocess  python  workaround  solution 
2 days ago by kme
python - SQLAlchemy default DateTime - Stack Overflow | https://stackoverflow.com/
You could use 'server_default=func.now()', but that will calculate a timestamp once per transaction, which may not be what you want.

This probably works fine:

<code class="language-python">
import datetime
from sqlalchemy import Column, Integer, DateTime
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()

class Test(Base):
__tablename__ = 'test'

id = Column(Integer, primary_key=True)
created_date = Column(DateTime, default=datetime.datetime.utcnow)

</code>
python  sqlalchemy  sql  timeanddate  timestamp  dba  solution 
2 days ago by kme
perl - How can I set default values using Getopt::Std? - Stack Overflow | https://stackoverflow.com/
The best thing is to use GetOpt::Long and use a hash instead of individual variables. Then you can pass default values by pre-populating the array
<code class="language-perl">
use Getopt::Long;
my %opts = (parameter => 20);
GetOptions( \%opts,
'p|parameter=i',
'o|outputfile=s',
'i|inputfile=s'
) or die "Invalid parameters!";
</code>
perl  argumentprocessing  shellscripting  getopt  solution 
3 days ago by kme
4 Laws That Could Stem the Rising Threat of Mass Shootings - Scientific American
—Require permits to purchase
—Ban individuals convicted of any violent crime from gun purchase
—Make all serious domestic violence offenders surrender firearms
—Temporarily ban active alcohol abusers from firearms
guns  violence  massacre  solution 
4 days ago by Quercki
MySQL :: Re: repair by sorting? | https://forums.mysql.com/
"Repair by sorting" is MyISAM's way of updating the indexes after a bulk insert. When inserting Millions of rows of data into a MyISAM table, it is normal for the index updates to take longer than the actual inserts.
mysql  dba  errormessage  solution 
7 days ago by kme
Index of /bin/linux/ubuntu | https://cran.r-project.org/
Some people have reported difficulties using this approach. The issue is usually related to a firewall blocking port 11371. If the first gpg command fails, you may want to try (thanks to Mischan Toosarani for the tip):
<code class="language-bash">
gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
</code>

and then feed it to apt-key with
<code class="language-bash">
gpg -a --export E298A3A825C0D65DFD57CBB651716619E084DAB9 | sudo apt-key add -
</code>

Another alternative approach is to search for the key at http://keyserver.ubuntu.com:11371/ and copy the key to a plain text file, say key.txt. Then, feed the key to apt-key with
<code class="language-bash">
sudo apt-key add key.txt
</code>
r  installation  ubuntu  packages  keyserver  errormessage  workaround  solution 
8 days ago by kme
apt - "GPG error:The following signatures were invalid: KEYEXPIRED" - Ask Ubuntu | https://askubuntu.com/
That ppa has been removed and no longer exists. You must find a different source for the packages installed through the samrog131 ppa.

In the meantime, run the following commands to resolve the situation.

First, to delete the expired key:
<code class="language-bash">
sudo apt-key del 1436387333
</code>

Then, to delete the ppa:
<code class="language-bash">
sudo rm /etc/apt/sources.list.d/samrog131*
sudo apt-get clean
sudo apt-get update
</code>

If you need to add a key see here.
<code class="language-bash">
sudo apt-get upgrade
</code>

You may want to run:
<code class="language-bash">
sudo apt-get dist-upgrade
</code>

depending on your situation. If you are not sure, see here.
ubuntu  apt  packagemanagement  crypto  pubkey  errormessage  solution 
8 days ago by kme
Study: Oakland's Ceasefire Program Curbs Shootings, Homicides
Violent crime is down overall in Oakland. Between 2011 and 2017, shootings with victims went from 710 to 340, a 52 percent drop.

Dr. Anthony A. Braga of Northeastern University and a team of researchers, however, compared areas of Oakland where Ceasefire was used and neighborhoods where it was not. The study, “Oakland Ceasefire Impact Evaluation,” also took into account population trends in Oakland and crime data in other California cities.

Among the key findings: Ceasefire is credited with a 31.5 percent drop in homicides involving a gun since it began in 2013. Shootings involving both gang members and non-gang members significantly decreased, but the decline was steeper among gang members. For example, Braga said the number of gang shootings in the two years before Ceasefire compared to four years after it was implemented dipped 43 percent. Non-gang member shootings were down 23 percent over the same period.

Of 12 cities throughout the state examined, the study authors said only two other cities, San Francisco and Stockton, experienced such significant reductions between 2010 and 2017. Richmond, East Palo Alto, Fresno, Sacramento and Long Beach were among the other cities.
Oakland  ceasefire  gun  violence  solution 
8 days ago by Quercki
(41) Patrisse Cullors - Posts
Statement From Patrisse Cullors on Historic Defeat of Los Angeles County Sheriff McDonnell By Alex Villanueva

"Since 2016 the progressive movement has been strategizing on how to build power and gain power. We lost the presidential race to a racist, sexist bigot and we’ve been experiencing the repercussions ever since.

In Los Angeles, we’ve dealt with our own set of racists elected officials. Sheriff Mcdonnell spent 4 years in office collaborating with ICE, knocking down reform initiatives like ending money bail and prop 47, and he refused to meet with community groups.

As of last night, Sheriff McDonnell is no longer the Sheriff of LA County.
election  L.A.  sheriff  Blackwater  solution 
9 days ago by Quercki
linux - How to strip path while archiving with TAR - Stack Overflow
In your "Extraction phase" you can use the strip-components flag like
<code class="language-bash">tar xvf tarname.tar --strip-components=n</code>
tar  archive  decompression  tipsandtricks  commandline  shellscripting  solution 
9 days ago by kme
gnu make - makefile: concatenate text with infix operator - Stack Overflow | https://stackoverflow.com/


Louis is correct: there's no magical way of doing this. But if, instead of trying to remove the last item or treat it specially, you instead treat the first item specially, the work is much simpler to understand (I think); you can create a function combine that takes two arguments: the first is the text to put between the words and the second is a space-separated list of words to combine:
<code class="language-makefile">combine = $(word 1,$2) $(foreach W,$(wordlist 2,$(words $2),$2),$1 $W)</code>

Now you can use it like this:
<code class="language-makefile">$(call combine,-o,$(EXCLUDE_LIST))</code>

to get output like:
<code class="language-">$(BASE_DIR)/aaa* -o $(BASE_DIR)/bbb*</code>
devel  build  toolchain  makefile  stringfunctions  workaround  solution 
9 days ago by kme
firebug - Access variables in jsFiddle from Javascript console? - Stack Overflow | https://stackoverflow.com/
With Firefox (34+) and the new Firefox Developer Edition, it's possibile to do the same by enabling the Select a frame as the currently targeted document extra tool into the developer tools, then click on it and select http://fiddle.jshell.net/_display/.
jsfiddle  webdevel  console  devtools  jquery  solution 
9 days ago by kme

« earlier    

related tags

'bitcoin  'impasse'  2-state  2017  2018  2to3  8  a  aardvark  abortion  addon  admin  afghanistan  agrachina  alternativeto  animatedgif  animation  annoyance  answer  anxiety  apache  app  apple  apt  architect  archive  argumentprocessing  arrays  asnonadmin  automate  automation  awk  aws  back  background  bash  batchprocessing  bedfiles  best  bioinformatics  biomart  blackwater  blockchain  body:  books  brief  browser  bsd  bug  build  business  cache  call  carbon  cash  ceasefire  centos6  certification  cgr  chain  change  chart  cheap  checksum  children  chloride  chrome  ci  clash  cli  click  client  climate  cloud  cms  co2  coding  college  commander  commandline  composer  computer  computing  config  configfile  configsettings  configuration  consent  console  consolidation  container  containers  contentdisposition  contrib  cool  copypaste  creative  criticism  crypto  css  csv  dammitbrain  day  dba  debian  decompression  decorators  deep  deprecated  desktop  dev  devel  devenv  devolution  devops  devtools  digital  disk  docker  drupal  drupal8  drush  dyinglight  eclipse  edu  education  election  elementhiding  enigma  ensembl  env  environment  error  errormessage  examining  exif  extension  fileio  filesystem  firefox  first  fishing  fix  for  form  forum  france  freidman  fridge  front  fstab  fuckina  future  futurism  game  geek  genghis  geometry  george  getopt  gilder:  gnome  google  gotcha  gui  guides  gulp  gun  guns  hacker  hardware  hash  have  headers  heal  hg19  history  homelessness  hotplug  howto  httpd  hvac  ibm  idea  ideas  idiom  image  imageprocessing  in  input  inputoutput  inputrc  insight  insights  inspiration  install  installation  internet  io  is  issue  it's  itertools  jobcontrol  jquery  jsfiddle  junipero_serra  just  keybindings  keyserver  khan  l.a.  language  learn  learning  legacy  libertarian  library  linux  love  lower  luna  mac  machine  machinegenerated  macos  macros  magnesium  makefile  making  management  manager  markdown  markdownhere  masculinity  massacre  math  me  mediawiki  meditation  meditations  men  messaging  metadata  mimetype  mind  mixin  mobile  module  money  motivate  mount  msps  mt  my  mysql  mysqladmin  native_american  network  networking  newbie  notfound  oakland  of  often  opensource  openssl  option  osx  packagemanagement  packages  packaging  packagist  pagan  patch  payroll  pc  performance  peripheral  perl  permissions  phone-system  photo  photography  php  phpcomposer  pip  pipes  plugin  political  politics  position  power  prep  printing  problem  processcontrol  productive  professional  programming  project_management  pubkey  pydev  python  question  quiet  r  racing  racism  read  readers  reading  readline  ref  reference  refugees  registers  releasing  row  sap  sass  says  scripting  scss  security  selenium  self-care  service  service_provider  setuptools  sexual_assault  sexual_harassment  sf  shellscripting  sheriff  sighmicrosoft  size  sleep  slow  solman  solutions  sort  sorting  sortof  speed  spinner  sponsored  sprinter  sql  sqlalchemy  ssl  stackoverflow  stanford  startupinthecloud  statue  stdin  stringfunctions  studio  subprocess  supply  support:  supports  symlink  syntax  sysadmin  systemreporting  tab  tabcompletion  tabdelimited  tapping  tar  taskrunner  teacher  tech  terminal  test  testing  textbook  textprocessing  the  thinking  thunderbird  time  timeanddate  timestamp  tipsandtricks  to  todo  tool  toolchain  toxic  training  trump  tui  typeglob  u.s.  ubuntu  university  unix  utility  variable  vibration  videos  vim  violence  virtualization  visionary  vpn  web  webbrowser  webdesign  webdevel  webdriver  webextension  webmaster  wifi  wiki  win10  win10home  window  windows  workaround  write:  your  zoom   

Copy this bookmark:



description:


tags: