Skip to content

Instantly share code, notes, and snippets.

View lewyuburi's full-sized avatar
✌️
Easy code, easy life

Lewis Yuburi lewyuburi

✌️
Easy code, easy life
View GitHub Profile
@joshuabaker
joshuabaker / gist:313648
Last active May 11, 2022 07:17
Get all images in a HTML string
<?php
/**
* Returns all img tags in a HTML string with the option to include img tag attributes
*
* @author Joshua Baker
*
* @example $post_images[0]->html = <img src="example.jpg">
* $post_images[0]->attr->width = 500
*
@cjus
cjus / jsonval.sh
Created June 26, 2011 17:42
Extract a JSON value from a BASH script
#!/bin/bash
function jsonval {
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop`
echo ${temp##*|}
}
json=`curl -s -X GET http://twitter.com/users/show/$1.json`
prop='profile_image_url'
picurl=`jsonval`
@zachbrowne
zachbrowne / googletrends.php
Created October 31, 2011 06:53
Generate Google Trends keywords with PHP
<?php
/*
This code is used for get the keywords from the
Google HotTrens.U can use the grabtrends() to get
the curerent trends words. it return an array of keywords
u can change the $url to get coountry specific keywords
ex: $url = "<a class="linkclass" href="http://www.google.co.in/trends/hottrends">http://www.google.co.in/trends/hottrends</a>";
gives the INDIAN keywords
*/
@thetrickster
thetrickster / Gruntfile.js
Created January 31, 2014 21:17
Foundation 5 Gruntfile.js to compile sass with libsass and copy bower components to /js/ in your project. Run `npm install && bower install` and then `grunt` to watch
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
options: {
includePaths: ['bower_components/foundation/scss']
},
dist: {
options: {
@cevaris
cevaris / generate_key.sh
Last active May 5, 2024 19:34
Sign and Verify using Python pycrypto
#!/usr/bin/env bash
# Generate RSA private key
openssl genrsa -out private_key.pem 1024
@taktran
taktran / rpi-led-notes.md
Last active July 22, 2022 14:20
Controlling Raspberry Pi 2 LEDs

Commands for controlling the Raspberry Pi 2 LEDs.

See rpi-leds for a node module that does this.

Power (PWR) LED

  • OK (ACT) LED = led0
  • Power (PWR) LED = led1

Allow access

@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@enginkartal
enginkartal / laravel5-nginx-virtualhost
Last active November 8, 2019 10:22
Laravel 5 - Nginx Virtual Host Conf
server {
listen 80;
root /usr/share/nginx/html/laravel/public;
index index.php index.html index.htm;
server_name laravel.dev;
location / {
try_files $uri $uri/ /index.php?$query_string;
@ownaginatious
ownaginatious / xhr.js
Last active August 16, 2023 09:56
React native XHR request
request = (opts) => {
return new Promise((resolve, reject) => {
let xhr = new XMLHttpRequest();
let url = opts.url;
let params = opts.query_params;
if (params && typeof params === 'object') {
params = Object.keys(params).map(function(key) {
return encodeURIComponent(key).replace(/%20/g, '+') +
'=' + encodeURIComponent(params[key]).replace(/%20/g, '+');
}).join('&');
@SalahAdDin
SalahAdDin / Steps.md
Last active May 29, 2022 06:11
Instlling React-Native Android Environment in ArchLinux

First step: Install Android SDK

  1. yaourt -S android-sdk android-sdk-platform-tools android-sdk-build-tools
    Note: Maybe you'll have problems with the lasta package: ncurses5-compat-libs. In order to avoid this problem you have to use this command: gpg --recv-keys F7E48EDB. You can find clarification here.
  2. yaourt -S genymotion
    Note: You'll need install virtual-box and his modules, yaourt will make for you but you need choos between ArchLinux host modules or DKMS host modules.
  3. Enter in super user mode with su - and then do echo -e "vboxdrv\nvboxnetflt\nvboxnetadp\nvboxpci" > /etc/modules-load.d/virtualbox.conf
    Note: You need do this with super user because need super user permissions and with sudo, for us at least, doesn't work.
  4. sudo modprobe vboxdrv vboxnetadp vboxnetflt
    Activate for current session.
  5. sudo chmod -R 777 /opt/android-sdk