Skip to content

Instantly share code, notes, and snippets.

View sonadztux's full-sized avatar
:octocat:
Working from home

Nanda Arfan Hakim sonadztux

:octocat:
Working from home
View GitHub Profile
@sonadztux
sonadztux / autopuas.js
Created April 8, 2022 05:59 — forked from bekicot/autopuas.js
Javascript Auto Sangat Puas untuk survey ga jelas Igracias.
javascript:(function(){
for(let radio of document.querySelectorAll("[id='radioX']")) {
radio.querySelectorAll('[type="radio"]')[0].checked = true
}
})();
@sonadztux
sonadztux / delete_all_line_breaks.py
Created October 18, 2020 17:37
Delete all line breaks on a txt file then replace with one line spacing
filename = input('Input your filename: ') # .txt
file = open(filename, 'r')
output_file = open(filename+'_out', 'w')
lines = file.readlines()
for line in lines:
line=line.replace('\n', ' ')
output_file.write(line)
@sonadztux
sonadztux / triangle.py
Last active October 3, 2019 11:50
Python simple script to generate triangle patter using for loop
for i in range(0, 3):
for j in range(i, 5):
print("*", end="")
print("\r")
for i in range(0, 4):
for j in range(0, i+1):
print("*", end="")
print("")
@sonadztux
sonadztux / Calculator.java
Created September 23, 2019 01:49 — forked from agrawal-priyank/Calculator.java
Evaluate an Arithmetic expression using Stacks in Java.
import java.util.Stack;
public class Calculator {
public enum Operator{ADD, SUBTRACT, MULTIPLY, DIVIDE, BLANK}
public static void main(String[] args){
String expression = "2-6-7*8/2+5";
Calculator calc = new Calculator();
System.out.println(calc.compute(expression));
@sonadztux
sonadztux / delete_all_tweets.py
Last active July 19, 2019 09:30 — forked from davej/delete_all_tweets.py
This script will delete all of the tweets in a specified account.
# -*- coding: utf-8 -*-
"""
This script will delete all of the tweets in the specified account.
You may need to hit the "more" button on the bottom of your twitter profile
page every now and then as the script runs, this is due to a bug in twitter.
You will need to get a consumer key and consumer secret token to use this
script, you can do so by registering a twitter application at https://dev.twitter.com/apps
@requirements: Python 2.5+, Tweepy (http://pypi.python.org/pypi/tweepy/1.7.1)
@sonadztux
sonadztux / duplicate_array_values_counter.js
Created July 19, 2019 08:05
A javascript function to counting duplicate of specific item/value in some array
const duplicateCounter = function (array, item) {
let itemLookingFor = [];
const arrayCopy = [...array]; // ES6 way to clone or copy an array to new array
arrayCopy.sort()
for (let i = 0; i < arrayCopy.length; i++) {
if(arrayCopy[i] === item) itemLookingFor.push(arrayCopy[i]);
}
return itemLookingFor.length;
}