Skip to content

Instantly share code, notes, and snippets.

# my solution:
def make_change(coins, n):
coins = list(coins)
if 'D' not in make_change.__dict__:
make_change.D = {}
id = tuple(coins), n
if id not in make_change.D:
coin = coins.pop(0)
make_change.D[id] = sum(make_change(list(coins), n-i*coin) for i in range(n//coin+1)) if coins else int(n % coin == 0)
@CNG
CNG / kill_unresponsive.scpt
Created November 1, 2017 06:23
Kill unresponsive app
tell application "Activity Monitor" to run --We need to run Activity Monitor
tell application "System Events" to tell process "Activity Monitor"
tell radio button 1 of radio group 1 of group 2 of toolbar 1 of window 1 to click --Using the CPU View
tell outline 1 of scroll area 1 of window 1 -- working with the list
set notResponding to rows whose value of first static text contains "Insync (Not Responding)" -- Looking for Not responding process
repeat with aProcess in notResponding
set pid to value of text field 5 of aProcess -- For each non responding process retrieve the PID
if pid is not "" then do shell script ("kill -9 " & pid) -- KILL the PID.
end repeat
end tell
@CNG
CNG / gist:129968fe9c952b6c7deafe20e3376897
Created February 18, 2019 02:51
uacpid install failure
$ aurman -S uacpid
~~ initializing aurman...
:: Ignoring installed package insync
~~ calculating solutions...
:: The following 11 package(s) are getting installed:
community/cabal-install / -> 2.4.0.0-46
community/ghc / -> 8.6.3-1
community/haskell-base16-bytestring / -> 0.1.1.6-12
community/haskell-cryptohash-sha256 / -> 0.11.101.0-7
@CNG
CNG / gist:91210da7b9b010b8552244d3072ac919
Created February 18, 2019 21:34
gnome-keyring-daemon
Feb 18 13:22:57 Charlie18c lightdm[2292]: pam_unix(lightdm:session): session opened for user cgorichanaz by (uid=0)
Feb 18 13:22:57 Charlie18c gnome-keyring-daemon[2299]: The gnome-keyring control directory cannot be accessed: /run/user/0/keyring: Permission denied
Feb 18 13:22:57 Charlie18c kernel: audit: type=1112 audit(1550524977.942:116): pid=2292 uid=0 auid=1000 ses=3 msg='op=login id=1000 exe="/usr/bin/lightdm" hostname=Charlie18c addr=? terminal=/dev/tty7 res=success'
Feb 18 13:22:57 Charlie18c audit[2292]: USER_LOGIN pid=2292 uid=0 auid=1000 ses=3 msg='op=login id=1000 exe="/usr/bin/lightdm" hostname=Charlie18c addr=? terminal=/dev/tty7 res=success'
Feb 18 13:22:57 Charlie18c gnome-keyring-daemon[2299]: couldn't create socket directory: /run/user/0/keyring-4TB7WZ: Permission denied
Feb 18 13:22:57 Charlie18c gnome-keyring-daemon[2299]: couldn't bind to control socket: /run/user/0/keyring-4TB7WZ/control: Permission denied