Skip to content

Instantly share code, notes, and snippets.

#!usr/bin/python
import sys
import urllib
from bs4 import BeautifulSoup as BS
if len(sys.argv) != 2:
print "Usage: %s thread_url"%(sys.argv[0])
sys.exit()
soup=BS(urllib.urlopen(sys.argv[1]).read())
for link in soup.find_all("p", class_="fileinfo"):
src = "https://lainchan.org"+link.find_next("a")['href'].encode("UTF-8")
@Shadey
Shadey / gist:756ded4b3062a60029ce
Created August 7, 2014 23:28
Hastebin Upload
if(@ARGV < 1){
print "Usage $0 filename1 filename2\n";
exit(1);
}
foreach (@ARGV){
my $file = `cat $_`;
my $r = `curl -s -X POST -d "$file" http://hastebin.com/documents`;
if($r =~ /\{"key":"(.*?)"\}/){
print "$_ : http://hastebin.com/$1\n";
}
import readline
import subprocess
import urllib
import urllib2
from sys import exit
from bs4 import BeautifulSoup as bs
def get_titles():
soup = bs((urllib2.urlopen("https://animetwist.net")))
titles = [t.text.replace(" ","_") for t in soup.select("li a") if t.text != "ONGOING"]
import java.util.stream.IntStream;
public class FizzBuzz {
public static void main(String[] args) {
IntStream.range(1,101).forEach(i->{
String result = (i % 15 == 0) ? "FizzBuzz":
(i % 3 == 0) ? "Fizz" :
(i % 5 == 0) ? "Buzz" :
Integer.toString(i);
System.out.println(result);
});
@Shadey
Shadey / Problem One.java
Last active August 29, 2015 14:06
Java 8 Project Euler
import java.util.stream.IntStream;
public class ProjectOne{
public static void main(String[] args){
System.out.println(IntStream.range(1, 1000).filter(n -> n % 3 == 0 || n % 5 == 0).sum());
}
}
@Shadey
Shadey / ispomf.sh
Last active August 29, 2015 14:06
I CANT MISS WHEN POMF COMES BACK UP I RUN THIS EVERY 15 MINUTE BRUH
title=$( curl 'http://pomf.se' -so - | grep -iPo '(?<=<title>)(.*)(?=</title>)')
[ "$title" == "Pomf will be back shortly" ] && notify-send "Pomf is down" ":c" || notify-send "Pomf is up" "c:"
@Shadey
Shadey / nyazo.sh
Created December 14, 2014 09:28
Nyazo.jp upload
#/usr/bin/sh
#Requires Imagemagick xclip curl
upload(){
link=`curl -s http://nyazo.ru/upload.php -F "id=''" -F "imagedata=@$1"`
echo $link
echo $link | xclip
}
filename="tempychicken.png"
if [ -z "$1" ]
then
*color0: #292929
*color8: #525252
! red
*color1: #cf6a4c
*color9: #ff9d80
! green
*color2: #99ad6a
*color10: #c3e6ad
! yellow
*color3: #fad07a
#requies xclip curl and imagemagick
#!/usr/bin/sh
upload(){
res=$(curl -s "http://pomf.se/upload.php" -F "files[]=@$1")
IFS='"' read -a array <<< $res
link="http://a.pomf.se/${array[17]}"
echo $link
echo $link | xclip -selection c
}
file="kok.png"
extern crate rand;
extern crate time;
use rand::Rng;
use time::PreciseTime;
trait Swappable{
fn swap(&mut self,a:usize,b:usize);
}
impl Swappable for Vec<i32>{