Skip to content

Instantly share code, notes, and snippets.

View lamlion's full-sized avatar
🎯
Focusing

Feisal Lam-Lion lamlion

🎯
Focusing
View GitHub Profile
@lamlion
lamlion / make_image_dd.txt
Last active January 10, 2018 13:13
Make and extract an image using dd
sudo dd if=/dev/rdisk1 bs=1m | gzip > ~/Desktop/pi.gz
gzip -dc ~/Desktop/pi.gz | sudo dd of=/dev/rdisk1 bs=1m
@lamlion
lamlion / domoticz_docker.sh
Created January 27, 2018 13:37
Domoticz Docker startup script
docker run --name=domoticz --privileged --cidfile="cid" -d -p 8080:8080 -t joshuacox/mkdomoticz:arm
mkdir -p domoticz-data
docker cp `cat cid`:/config - |sudo tar -C domoticz-data/ -pxf -
# kill container and recreate with volume
@lamlion
lamlion / docker_commands.txt
Last active April 12, 2018 22:10
Useful single docker commands
Install Docker on ARM:
https://docs.docker.com/install/linux/docker-ce/debian/
Compile docker-compose on ARM:
$ git clone https://github.com/docker/compose.git
$ cd compose
$ git checkout release
$ docker build -t docker-compose:armhf -f Dockerfile.armhf .
$ docker run --rm --entrypoint="script/build/linux-entrypoint" -v $(pwd)/dist:/code/dist -v $(pwd)/.git:/code/.git "docker-compose:armhf"
@lamlion
lamlion / Mac OS X: Open in Visual Studio Code
Created May 30, 2018 21:26 — forked from tonysneed/Mac OS X: Open in Visual Studio Code
Add a command to Finder services in Mac OSX to open a folder in VS Code
- Open Automator
- File -> New -> Service
- Change "Service Receives" to "files or folders" in "Finder"
- Add a "Run Shell Script" action
- Change "Pass input" to "as arguments"
- Paste the following in the shell script box: open -n -b "com.microsoft.VSCode" --args "$*"
- Save it as something like "Open in Visual Studio Code"
@lamlion
lamlion / bulk_pypdfocr.py
Created June 11, 2018 08:04
Bulk PYPDFOCR Python script
import glob
import os
import re
pwd = os.getcwd()
searchpdf = pwd+'/*/testfile.pdf'
files = glob.glob(searchpdf)
num = len(glob.glob(searchpdf))
@lamlion
lamlion / docker-compose.yml
Created June 28, 2018 14:04 — forked from SnowMB/docker-compose.yml
nextcloud_nginx_letsencrypt_mariadb
version: '2'
services:
nginx:
image: jwilder/nginx-proxy
container_name: nginx
ports:
- 80:80
- 443:443
@lamlion
lamlion / aws_ami_post_commands.txt
Last active July 7, 2018 00:12
AWS EC2 simple AMI with docker post commands
#!/bin/bash
yum update -y
yum install docker -y
yum install curl -y
yum install git -y
service docker start
curl -L https://github.com/docker/compose/releases/download/1.22.0-rc1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
echo 'export PATH=/usr/local/bin:$PATH' | tee -a /etc/profile –
groupadd docker
@lamlion
lamlion / highsierra_bootable.sh
Last active August 4, 2018 08:06 — forked from agentsim/highsierra_bootable.sh
Create bootable ISO from HighSierra Installer
# Generate a BaseSystem.dmg with 10.13.3 Install Packages
hdiutil attach /Applications/Install\ macOS\ High\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -mountpoint /Volumes/highsierra
hdiutil create -o /tmp/HighSierraBase.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/HighSierraBase.cdr.dmg -noverify -mountpoint /Volumes/install_build
asr restore -source /Applications/Install\ macOS\ High\ Sierra.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
cp -R /Volumes/highsierra/Packages /Volumes/OS\ X\ Base\ System/System/Installation
hdiutil detach /Volumes/OS\ X\ Base\ System/
hdiutil detach /Volumes/highsierra/
mv /tmp/HighSierraBase.cdr.dmg /tmp/BaseSystem.dmg

Keybase proof

I hereby claim:

  • I am lamlion on github.
  • I am lamlion (https://keybase.io/lamlion) on keybase.
  • I have a public key ASD0jFGvf9BCb3YMG0IrgcuKoDMIK4_oT6RnrX7sdiKGYgo

To claim this, I am signing this object:

@lamlion
lamlion / BackupWindowsProductKey.vbs
Last active November 15, 2018 22:10
Windows Product key backup script
Option Explicit
Dim objshell,path,DigitalID, Result
Set objshell = CreateObject("WScript.Shell")
'Set registry key path
Path = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
'Registry key value
DigitalID = objshell.RegRead(Path & "DigitalProductId")
Dim ProductName,ProductID,ProductKey,ProductData
'Get ProductName, ProductID, ProductKey