This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ub/* | |
Showing number 0-9 on a Common Anode 7-segment LED display | |
Displays the numbers 0-9 on the display, with one second inbetween. | |
A | |
--- | |
F | | B | |
| G | | |
--- | |
E | | C | |
| | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let dest = "/tmp/m/a" | |
let src = "/tmp/m/b" | |
let fileManager = FileManager(); | |
let targetURL = URL.init(fileURLWithPath: dest) | |
let srcURL = URL.init(fileURLWithPath: src) | |
do { | |
try fileManager.replaceItemAt(targetURL, withItemAt: srcURL) | |
} catch { | |
print(error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const merge = require('deepmerge') | |
module.exports = neutrino => { | |
neutrino.config.module | |
.rule('compile') | |
.use('babel') | |
.tap(options => merge(options, { plugins: ['transform-class-properties'] })) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component( selector: 'user-role', | |
template: r''' | |
<span *ngIf="userRole != null && long" >{{ userRole.completeLabel }}</span> | |
<span *ngIf="userRole != null && !long" >{{ userRole.label}}</span> | |
''') | |
class UserRoleComponent { | |
UserRole userRole; | |
@Input() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
mkpasswd -m sha-512 -R 150000 -s -S $(openssl rand -hex 32 | cut -b 1-16) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
CREDENTIALS="" | |
if [ ! -z "$DOCKER_USER" ] && [ ! -z "$DOCKER_PWD" ]; then | |
CREDENTIALS="$DOCKER_USER:$DOCKER_PWD@" | |
fi | |
if [ ! -z "$CREDENTIALS" ]; then | |
docker login -u "$DOCKER_USER" -p "$DOCKER_PWD" -e "test@email.my" "$DOCKER_REGISTRY" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn om-component [data owner] | |
(om-tools/component | |
(init-state [_} {:counter 1}) | |
(render-state [_ state] (dom/div nil (str "Hello " (:name data) ": " (:counter state)))) | |
(will-unmount [_] (.log js/console "bye")))) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am zuzkins on github. | |
* I am zuzkins (https://keybase.io/zuzkins) on keybase. | |
* I have a public key whose fingerprint is DADA D47C 4F70 37A5 AEB6 B546 0E24 4857 7705 9F04 | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import spray.http._ | |
import shapeless.HNil | |
import spray.util.pimpSeq | |
def withContentType(ctStr: String): Directive0 = { | |
def isContentType(h: HttpHeader) = h match { | |
case HttpHeaders.`Content-Type`(ContentType(MediaType(mt), _)) ⇒ Some(mt) | |
case _ ⇒ None | |
} | |
extract(_.request.headers.mapFind(isContentType(_))).flatMap[HNil] { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export $(xargs -n 1 -0 echo </proc/$(pidof gnome-session)/environ | grep -Z DBUS_SESSION_BUS_ADDRESS=) | |
#DISPLAY=:0 | |
WALLPAPERS="BIG_WALLPAPER_COLLECTION_DIR" | |
ALIST=( `ls -w1 $WALLPAPERS` ) | |
RANGE=${#ALIST[@]} | |
let "number = $RANDOM" | |
let LASTNUM="`cat $WALLPAPERS/.last` + $number" | |
let "number = $LASTNUM % $RANGE" | |
/usr/bin/gconftool-2 -t string -s "/desktop/gnome/background/picture_filename" "$WALLPAPERS/${ALIST[$number]}" |