Skip to content

Instantly share code, notes, and snippets.

@rodamora
rodamora / agent loop
Created March 10, 2025 12:06 — forked from jlia0/agent loop
Manus tools and prompts
You are Manus, an AI agent created by the Manus team.
You excel at the following tasks:
1. Information gathering, fact-checking, and documentation
2. Data processing, analysis, and visualization
3. Writing multi-chapter articles and in-depth research reports
4. Creating websites, applications, and tools
5. Using programming to solve various problems beyond development
6. Various tasks that can be accomplished using computers and the internet
@rodamora
rodamora / install-cuda-10-bionic.sh
Created January 30, 2020 23:55 — forked from bogdan-kulynych/install-cuda-10-bionic.sh
Install CUDA 10 on Ubuntu 18.04
# WARNING: These steps seem to not work anymore!
#!/bin/bash
# Purge existign CUDA first
sudo apt --purge remove "cublas*" "cuda*"
sudo apt --purge remove "nvidia*"
# Install CUDA Toolkit 10
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
@rodamora
rodamora / fail2ban.sh
Created September 30, 2017 17:27
Install and Configure Fail2Ban
# install using repository
apt-get install -y fail2ban
apt-get install -y sendmail
Sets the basic configuration files
cp /etc/fail2ban/fail2ban.conf /etc/fail2ban/fail2ban.local
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
@rodamora
rodamora / utils-network-connectivity.java
Created January 20, 2016 10:37
Function to check if there is network connectivity
public boolean isNetWorkAvailable(Context context){
ConnectivityManager connectivityManager =
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
if(networkInfo != null && networkInfo.isConnected()){
return true;
}
return false;
}
@rodamora
rodamora / insert-fragment.java
Created January 19, 2016 20:22
Insert a new fragment
Fragment newFragment = new DebugExampleTwoFragment();
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.add(CONTENT_VIEW_ID, newFragment).commit();
@rodamora
rodamora / mvp-android.java
Created January 19, 2016 18:08
MVP on Android
interface MessageView {
// View methods should be directives, as the View is just executing orders from the
// Presenter.
// Methods for updating the view
void setMessageBody(String body);
void setAuthorName(String name);
void showTranslationButton(boolean shouldShow);
// Navigation methods
@rodamora
rodamora / dagger2.java
Last active January 19, 2016 12:00
Dagger2 Usage Description
// For classes whose modules provide dependencies
@Module
// For the methods within @Module classes
@Provides
// To request a dependency
@Inject
// Bridge between modules and injection
@rodamora
rodamora / 0_reuse_code.js
Created January 19, 2016 10:33
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rodamora
rodamora / floating-action-button.java
Created January 19, 2016 09:56
Android Floating Action Button
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
@rodamora
rodamora / cerebral-angular2-decorator.ts
Last active January 14, 2016 23:30
Sample implementation of a decorator for angular2 using cerebral
/**
* Angular2 decorator for Cerebral
* @param paths the paths that will be retrieved from the state
* 1. It holds its own state object based on the paths passed in the decorator
* 2. When the controller triggers a "change" event, the decorator grabs the same state again from the controller and compares it with the existing state
* 3. If the state has changed, the state property is updated
* 4. If not, it is left alone
*/
let controller: Cerebral;
let callbacks: Function[] = [];