Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@cyrexcyborg
cyrexcyborg / gist:b3c5d06b96a2a3ead99a
Created July 28, 2014 06:05
Tags-from-joyreactor.py
from bs4 import BeautifulSoup as bs
from urllib2 import urlopen
from time import sleep
soup = bs(html,"lxml")
gen_urls = [x for x in range(80000, 80002)]
base_url = 'http://joyreactor.cc/new/'
enlist_urls =[base_url+str(item) for item in gen_urls]
@cyrexcyborg
cyrexcyborg / JoinStringsTest.java
Created November 23, 2019 10:36
A Java 8 approach to do strings join
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
/*
* Test for joining collection of String's into one
* like ["a", "aaa", "bbbb", "Dda"] to "a,aaa,bbbb,Dda"
@cyrexcyborg
cyrexcyborg / relations.py
Last active June 29, 2020 12:32
Flask-Admin-SQLAlchemy one-to-one, one-to-many between two tables
# -*- coding: utf-8 -*-
# Many thanks to http://stackoverflow.com/users/400617/davidism
# This code under "I don't care" license
# Take it, use it, learn from it, make it better.
# Start this from cmd or shell or whatever
# Go to favourite browser and type localhost:5000/admin
import sys
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.admin import Admin
@cyrexcyborg
cyrexcyborg / DuplicateWords.java
Created July 19, 2020 18:32
Find duplicate words RegExp
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class DuplicateWords {
/*
https://rubular.com/r/98MZ0vzUeX
\b : Any word boundary (\w+) : Select any word character (letter, number, underscore)
( : Grouping starts
@cyrexcyborg
cyrexcyborg / gist:9b645653f7a5f7d20fd8bf508136b666
Created June 4, 2021 08:59
Snippet to generate dummy file on Windows
fsutil file createnew dummy.gz 306552800