Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
int h, m, s, n;
int total_s;
int to_timestamp(int h, int m, int s) {
return (h * (60 * 60)) + (m * 60) + s;
}
void to_hms_tuple(int timestamp, int *h, int *m, int *s) {
#include <cstring>
#include <cmath>
#include <iomanip>
#include <cstdio>
#define sqr(x) ((x) * (x))
#define debug(a) printf a
//#define debug(a) ;
FILE *in, *out;
@tuankiet65
tuankiet65 / 4share-undelete.py
Last active October 13, 2017 13:36
Script to un-delete deleted but restorable files on 4Share (requires user account). Script depends on requests and beautifulsoup4.
import requests
import re
import time
from bs4 import BeautifulSoup
# Login by some means (in the browser, curl, etc) and paste the cookie value here
COOKIES = {
"__tawkuuid": "",
"SHARINGSESSID4S": ""
}
#include <fstream>
#include <iostream>
std::ifstream in("fib2.inp");
std::ofstream out("fib2.out");
struct fib_str {
uint32_t len;
uint32_t count_a;
};
#include <cstdio>
#include <algorithm>
#include <vector>
int n;
std::vector<int> a;
int main(){
int i, tmp;
int count_1 = 0, count_2 = 0, len = 0;
@tuankiet65
tuankiet65 / calc.cs
Last active March 30, 2017 10:34
Simple calculator in C# (fixing for a friend)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@tuankiet65
tuankiet65 / low_entropy.md
Last active March 29, 2017 15:50
Solution to picoCTF 2014 problem Low Entropy

Low Entropy

Solution

Getting all public key pairs

  • There are only 30 primes in the random pool in which p and q was chosen, so there're a maximum of 465 p*q pairs. What's more, p != q, so the number drops down to 435.
  • As the number is small, we can put nc in a loop to continously get p*q pairs until we have the required unique pairs:
while true; do nc vuln2014.picoctf.com 51818 | tail -n 1 >> keys.txt; done
@tuankiet65
tuankiet65 / .Xresources
Last active March 21, 2017 14:14
My i3 config
URxvt.secondaryScreen: 1
URxvt.secondaryScroll: 0
URxvt.background: #000000
URxvt.foreground: #ffffff
URxvt*color0: #000000
URxvt*color1: #B40000
URxvt*color2: #00AA00
URxvt*color3: #AAAA00
minimum damamge 2
spell params: rolls 2 sides 4 penalty 0
possible 16 invalid 0
spell params: rolls 1 sides 8 penalty 0
possible 8 invalid 1
minimum damamge 10
spell params: rolls 10 sides 6 penalty -10
possible 60466176 invalid 89518
spell params: rolls 1 sides 6 penalty 1
possible 6 invalid 6
@tuankiet65
tuankiet65 / lrkpalin.cpp
Created December 18, 2016 04:05
LRKPALIN
#include <cstdio>
#include <iostream>
#include <cstring>
FILE *in, *out;
char s[10001];
int k, q, len, i, x, y;
short table[10000][10000];