Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Dan Ruiyot danruiyot

🏠
Working from home
View GitHub Profile
@danruiyot
danruiyot / Mains.java
Created May 7, 2021
Print statement like python in java :-)
View Mains.java
import java.util.Scanner;
public class Mains {
public static void main(String[] args) {
print("What is your name ? :");
String input = input();
print("your name is : " + input);
@danruiyot
danruiyot / Media.php
Created Jan 13, 2021
codeigniter 3 file upload method
View Media.php
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Event extends MY_Controller{
function __construct()
{
parent::__construct();
}
//$file is the file name from form input
//example is <input type="file" name="my_image" >
View fibonacci.py
def fib(n):
if n<=0:
print("invalid input")
elif n==1:
return 0
elif n==2:
return 1
else:
return fib(n-1)+fib(n-2)
@danruiyot
danruiyot / faker.py
Created Dec 25, 2020
generate fake data for your database
View faker.py
import sqlite3
from faker import Faker
from random import randrange
fake = Faker()
conn = sqlite3.connect('users.sqlite3')
cursor = conn.cursor()
@danruiyot
danruiyot / friendrequest.js
Last active Dec 26, 2020
send many friend requests at a go
View friendrequest.js
var btn = document.getElementsByTagName('button');
for(let i=0; i<btn.length; i++){
btn[i].click();
console.log(i);
}
//open https://m.facebook.com/friends/center/requests/
// open consoe
// copy your console
// run
// happy hacking !!
@danruiyot
danruiyot / Fibonacci.java
Created Nov 18, 2020
Fibocacci sequence recursively and by iteration
View Fibonacci.java
/**
*
* @author ruiyot
*/
public class Fibonacci {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
@danruiyot
danruiyot / organize.sh
Created Oct 30, 2020
organize your downloads linux shell
View organize.sh
#! /bin/sh
for file in *.mp4 *.mov *.mkv *.flv *.avi *.webm *.wmv; do
mv -- "$file" /home/$USER/Videos
done
for file in *.jpg *.png *.webp *.svg *.jp*g *.JPG *.gif; do
mv -- "$file" /home/$USER/Pictures
done
for file in *.mp3 *.mpeg *.m4a *.aac *.wma; do
View matrix.cpp
//for 10 * 10 matrix
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <chrono>
using namespace std;
using namespace std::chrono;
class matrixc
View WordSearch.java
import java.io.*;
import java.util.*;
// WordSearch class interface: solve word search puzzle
//
// CONSTRUCTION: with no initializer
// ******************PUBLIC OPERATIONS******************
// int solvePuzzle( ) --> Print all words found in the
// puzzle; return number of matches