Skip to content

Instantly share code, notes, and snippets.

View nightsh's full-sized avatar
😱
Nope.

Victor Nițu nightsh

😱
Nope.
View GitHub Profile
@nightsh
nightsh / rules
Created October 11, 2012 22:16
debian/rules for python-virtkey
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
PYVERS := $(shell pyversions -vs)
PYVER := $(shell pyversions -vd)
PY3VERS := $(shell py3versions -vs)
@nightsh
nightsh / gist:5094394
Created March 5, 2013 21:21
iceweasel-killer.sh
#!/bin/bash
echo -n "Introdu numele utilizatorului care va folosi Mozilla Firefox [$(whoami)]: "
read USER
echo -n "Introdu grupul care va utiliza Firefox [$(id -gn)]: "
read GROUP
echo -n "URL-ul arhivei pentru instalare: "
read URL
echo -n "Vrei să blochezi actualizările Iceweasel (recomandat) - doar dacă ești logat ca root [D/n] "
read DPKG
@nightsh
nightsh / uglify_query.php
Created April 16, 2013 14:24
uglify_query - a function to remove unneded spacing out of SQL queries
<?php
/** uglify_query - a function to remove unneded spacing out of SQL queries
*
* This is a very basic function that can be used both in OOP and non-OOP
* environments, transforming an SQL query that was formatted for readibility
* into a short, one-liner, single-spaced query that won't produce a nasty log
* pollution and line noise.
*
* @param string $query The pretty formatted query, with tabs, newlines etc.
<?php
$email_to = "sendto@email.com"; // The email you are sending to (example)
$email_from = "sendfrom@email.com"; // The email you are sending from (example)
$email_subject = "subject line"; // The Subject of the email
$email_txt = "text body of message"; // Message that the email has in it
$fileatt = "/home/decibelp/public_html/OpenInviter/download.zip"; // Path to the file (example)
$fileatt_type = "application/zip"; // File Type
$fileatt_name = "download.zip"; // Filename that will be used for the file as the attachment
$file = fopen($fileatt,'rb');
<?php
$table = array(
'Petru?' => 'Petruț',
'Chi?in?u' => 'Chișinău',
'Vulc?ne?ti' => 'Vulcănești',
'hor?' => 'horă',
'Vacan?a' => 'Vacanța',
'Constan?a' => 'Constanța',
'Buz?u' => 'Buzău',
@nightsh
nightsh / clive-grab-all
Created January 5, 2014 00:38
clive grab all youtube URLs from a html file
elinks -dump 1 list.html | grep 'watch?v=' | sed 's;file:///;http://youtube.com/;g' | sed 's/&list=.*//' | awk '{print $2}' | sed '/^ *$/d' | uniq > list.txt
@nightsh
nightsh / gist:8328211
Created January 9, 2014 02:06
watch every log file for changes
find /var/log -xdev -type f -exec tail -fn0 {} +
#!/bin/bash
# This script creates a new project (or site) under /var/sites and creates
# new virtual host for that site. With the options a site can also
# install the latest version of Laravel directly.
# This script was originally based on the following script by @Nek from
# Coderwall: https://coderwall.com/p/cqoplg
# Display the usage information of the command.
create-project-usage() {

MONDRAKER FACTOR (2600): full, sram x5/x7 http://www.dirtbike.ro/bazar/biciclete/mtb-all-mountain-enduro/mondraker-factor-219603

SIMPLON FULL SUSPENSION (1950): full, xt/xt, 26", mountain king http://www.dirtbike.ro/bazar/biciclete/mtb-all-mountain-enduro/simplon-full-suspension-233340

FOCUS RAVEN FULL XT (1900): hardtail, xt/xt, 26", fr. hidra http://www.dirtbike.ro/bazar/biciclete/mtb-all-mountain-enduro/vand-focus-raven-full-xt--232225

(*) RockRider 9.1 (1900): full, sram x7/x9, 26", fr. hidra

require 'mechanize'
base = 'https://graph.facebook.com/v2.3/'
route = 'me/feed?since=06.04.2015'
access_token = {'access_token' => ENV['ACCESS_TOKEN']}
variations = %w(happy bday birthday mulți multi ani trăiești traiesti)
agent = Mechanize.new
response = JSON.parse(agent.get(base + route, access_token).body)