This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from modulebase import ModuleBase,ModuleHook | |
# import random | |
import yaml | |
import os | |
import time | |
from threading import Timer | |
from operator import itemgetter | |
from random import choice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try{ | |
BufferedReader reader = new BufferedReader(new FileReader("fileName.txt")); | |
String line = ""; | |
while ((line = reader.readLine())!=null){ | |
//Do something with the line, say store it in an array | |
} | |
reader.close(); | |
} | |
catch (FileNotFoundException e){ | |
e.printStackTrace(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static String percentEncode(String s){ | |
String result = ""; | |
for (int i=0; i<s.length(); i++){ | |
char check = s.charAt(i); | |
if (Character.isLetter(check) || Character.isDigit(check) || check == '-' || check=='.' || check=='_' || check == '~' ){ | |
result+=check; | |
} | |
else{ | |
result+=("%"+Integer.toHexString(check)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bitmap profileBitmap = BitmapFactory.decodeStream(connection.getInputStream()); | |
Bitmap finalBitmap = Bitmap.createBitmap(profileBitmap.getWidth(),profileBitmap.getHeight(),Bitmap.Config.ARGB_8888); | |
Canvas canvas = new Canvas(finalBitmap); | |
Path p = new Path(); | |
p.addCircle(profileBitmap.getHeight()/2,profileBitmap.getHeight()/2,profileBitmap.getWidth()/2,Path.Direction.CCW); | |
canvas.clipPath(p);; | |
canvas.drawBitmap(profileBitmap,new Rect(0,0,profileBitmap.getHeight(),profileBitmap.getWidth()),new Rect(0,0,profileBitmap.getHeight(),profileBitmap.getWidth()),null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function timeStringtoTime(s){ | |
if (s.indexOf('ms')!=-1){ | |
var result = s.replace('ms',''); | |
console.log(result); | |
return parseInt(result); | |
} | |
else{ | |
var result = s.replace('s',''); | |
return parseFloat(result)*1000; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <sys/wait.h> | |
#include <sys/types.h> | |
void forkAndCalculate(int num); | |
int main(int argc, char **argv){ | |
if (argc!=2 || argv[1]<0){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-----BEGIN PGP PUBLIC KEY BLOCK----- | |
mQINBFSU+Q4BEADMyVK/kBHWsgFwQ5GATc7bdviuZCb0O0CFHVO2y+ROyoMEwkTz | |
y23WBvNJLczzjPHhEE5XvLA/0/KCRbT1pGCbqIzSduZFx0Crb3RmQ49bDsYt4caF | |
VhbF8XHNjo7/yd8E6fGuC5B4rOydEz+vsBL55P0k3pGQ+N149gIdTwxn2FDCETT8 | |
aXRXQzBQso/uDF3SfmQBglSl1uxG+wVV7git3rMFzDJpUcp9ztp/5jhuuzSoCwwV | |
+KDG0vBRs7k6UImrYY7vq6sC3YRTxw3nNIGXuwOUWKFN/a/tWdtFvq0GdU9Kl1Xz | |
XTxWhQGPj+7RaTV1AvPVGmmmQZR6Ra6lDS/NlgDBth/4sta6euaVY0bKnD7O8ukE | |
AufU1izPZwjVDzqke0igZPRLbmTxQIOB5mAqFUKWsfFrVHU1m/2ZTlxQ6BVMvtgI | |
1a8RY/bme3Hvps2wFisiMZstkdDYlhqJZYtd5ndXa027hn/Stld0fHUt44b2gRcJ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle savedInstanceState){ | |
final View view = inflater.inflate(R.layout.fragment_timeline,viewGroup,false); | |
final SwipeRefreshLayout refreshLayout = (SwipeRefreshLayout)view.findViewById(R.id.refresh); | |
ListView timelineView = (ListView) view.findViewById(R.id.timelineList); | |
//... | |
return view | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Nicks-MBP:~ Nick$ ab -n 2048 -c 5 http://127.0.0.1:8080/ | |
This is ApacheBench, Version 2.3 <$Revision: 1604373 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking 127.0.0.1 (be patient) | |
Completed 204 requests | |
Completed 408 requests | |
Completed 612 requests | |
Completed 816 requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import time | |
from termcolor import cprint | |
colors = ["grey", "red", "green", "yellow", "blue", "magenta", "cyan", "white"] | |
while True: | |
tempColors = list(colors) | |
foreground = random.choice(tempColors) | |
tempColors.remove(foreground) |
OlderNewer