Skip to content

Instantly share code, notes, and snippets.

View groupsky's full-sized avatar
💭
I may be very slow to respond.

Geno Roupsky groupsky

💭
I may be very slow to respond.
  • Plovdiv/Bulgaria
View GitHub Profile
@jarvisluong
jarvisluong / upload_to_pcloud.sh
Created July 20, 2017 08:46
Upload file to Pcloud via Rest API
#!/bin/bash
while :
do
zip -r $ZIP_FILENAME $FOLDERNAME && curl -F 'filename=@$ZIP_FILENAME' 'https://api.pcloud.com/uploadtolink?code=$PCLOUD_UPLOAD_CODE' && rm -f $ZIP_FILENAME && sleep $SLEEPTIME
done
#ZIP_FILENAME: file name of the zip you want to name it
#FOLDERNAME: the folder you want to zip
#PCLOUD_UPLOAD_CODE: go to pcloud, generate an upload link, you will find the code
#SLEEPTIME: the sleep interval for each upload cycle, if you want this to be a loop
#!/bin/sh
################################################################
# Individual channel setting per distinct AP
case `uci get system.@system[0].hostname` in
"ap1")
CHANNELS="36 1"
;;
"ap2")
@staltz
staltz / introrx.md
Last active June 3, 2024 11:21
The introduction to Reactive Programming you've been missing
@andreyvit
andreyvit / remove-old-db-backups.sh
Created March 24, 2012 08:07
A script to remove old DB backup files, keeping one backup per month, one backup per day for the last X months and the last Y backups.
#! /bin/bash
# vim: sw=2 ts=2 et ai
NUM_OLDEST_BACKUPS_TO_KEEP=1
NUM_RECENT_BACKUPS_TO_KEEP=100
NUM_MONTHS_TO_KEEP_DAILY_BACKUPS=4
AUTOMATIC_REMOVAL_THRESHOLD=40
# Deletes old DB backup files from the folder specified as an argument.
#
@parkerl
parkerl / extract_and_download_images_from_css.md
Created February 8, 2012 18:31
Extract image URLs from a CSS file and download them onto a new server (Linux)

#Extract Image URLs and WGet Them to a New Server#

This was a fun problem. I needed to move all the images referenced in a CSS file to another server. I didn't want to just grab all the image files as there were a bunch I didn't need. Here is how I went about it. I am sure you could do it in one step but doing it this way gives you a chance to check for errors.

First you may want to use wget http://otherserver/the_css.css to pull the CSS file on to the target server if it is still on the old server as it was in my case.

  1. User grep to extract the URLs from the css file into another file. (You may need to adjust the regular expression if you have funny characters in your file names) Note the use of the -o flag that tells grep to only print out that part of the line that matches the expression rather than the entire line.

     grep -o '\/path\/to\/files\/[a-zA-Z0-9/.:_-]*' the_css.css > images.txt
    
@dshaw
dshaw / min_jquery_version.js
Created October 29, 2010 03:42
Determine if a page has the minimum jQuery version you need to do what you're doing.
function minVersion(version) {
var $vrs = window.jQuery.fn.jquery.split('.'),
min = version.split('.');
for (var i=0, len=$vrs.length; i<len; i++) {
console.log($vrs[i], min[i]);
if (min[i] && $vrs[i] < min[i]) {
return false;
}
}
return true;